//
//  AppDelegate.h
//  GolfFriend
//
//  Created by vescky on 13-11-24.
//  Copyright (c) 2013年 vescky.org. All rights reserved.
//

#import <UIKit/UIKit.h>
#import "LoginPageViewController.h"
#import "HomePage2ViewController.h"
#import "JASidePanelController.h"
#import "SideBarViewController.h"
//#import "BMapKit.h"
#import "TestViewController.h"
#import "DXAlertView.h"
#import "ToolbarViewController.h"
#import "ImageUploader.h"

#define APP_DELEGATE (AppDelegate*)[[UIApplication sharedApplication] delegate]

@protocol ImageUploadQueueDelegate <NSObject>

@optional
- (void)ImageUploadQueueItemSuccess:(NSString *)filePath ret:(NSDictionary *)ret;
- (void)ImageUploadQueueItemFail:(NSString *)filePath error:(NSError *)error;
- (void)ImageUploadQueueItemProcessUpdated:(NSString *)filePath percent:(float)percent;

@end

@interface AppDelegate : UIResponder <UIApplicationDelegate,ImageUploaderDelegate> {
//    BMKMapManager* _mapManager;
    DXAlertView *loginAlert;
    UIView *messageNotiView;
//    NSMutableArray *imageArrayTotal,*imageArrayFailed;
    __block int uploadImageIndex;
    ImageUploader *imageUploaderSerialQueue;
    NSMutableArray *arrForFialToUploadImages,*arrWaitingToUpload;
}

@property (strong, nonatomic) UIWindow *window;

@property (strong, nonatomic) HomePage2ViewController *hpViewController;
@property (strong, nonatomic) LoginPageViewController *loginViewController;
@property (strong, nonatomic) JASidePanelController *sidePannelController;
@property (strong, nonatomic) SideBarViewController *sideBarViewController;
@property (strong, nonatomic) id tViewController;
@property (nonatomic,retain) UINavigationController *navigationController;
@property (nonatomic,strong) CLLocation *userCurrentLocation;

@property (assign, nonatomic) UIBackgroundTaskIdentifier backgroundUpdateTask;

@property bool isGettingMessage;

//@property int photoAlbumSelectedCounter;
@property (nonatomic,strong) NSMutableArray *photoAlbumSelectedArray;

#if ShowToolbarInWindow == 1
@property (nonatomic,strong) ToolbarViewController *gfToolbar;
#endif

@property (assign,nonatomic) id <ImageUploadQueueDelegate> imageUpoadQueueDelegate;

- (void)refreshContactBook;
- (void)showMessageAlertOnStatusBar:(NSString*)alertTitle;
- (void)closeMesageStatusBarAlert;
- (void)getMessagesFromServerOnBackground;//后台获取消息
- (void)doLogin;
- (void)setToolbarHidden:(bool)isHidden;
- (void)checkNewVersion:(bool)needNotAlert;

//- (void)setImageUpoadQueueDelegate:(id<ImageUploadQueueDelegate>)imageUpoadQueueDelegate;
- (void)uploadImageWithArray:(NSArray*)arr saveNameList:(NSArray*)arrName submitToSinaPaarms:(NSMutableDictionary*)paramsSina;

@end
